<?php
    include('./config.php');
    include('./request.php');
    $market_id = $result->market_id;
    $market_name = $result->market_name;
    $market_type = $result->market_type;
    $market_author = $result->market_author;
    $market_phone = $result->market_phone;
    $market_email = $result->market_email;
    try{
        $pdo = new PDO($dsn,$user,$pass);
        $pdo->beginTransaction();
        $sql = "update market set market_name = '".$market_name."',market_type='".$market_type."',market_author='".$market_author."',market_email='".$market_email."',market_phone='".$market_phone."' where market_id = ".$market_id;
        $res = $pdo->prepare($sql);
        $res->execute();
        if($res){
            echo "ok";
            $pdo->commit();
        }else{
            echo "error";
            $pdo->rollBack();
        }
    }catch(PDOException $e){
        $pdo->rollBack();
        echo "error";
    }
?>